let loading //加载用公共变量

module.exports = {
	url: '/api',

	// 文件请求头
	head_url: 'https://img.zhongfuyun.com/',

	openLoading: function () {
		//开启loading
		var loadBox = document.getElementsByClassName('loadBox')[0]
		loadBox.style.width = document.documentElement.clientWidth + 'px'
		loadBox.style.height = document.body.offsetHeight + 'px'
		loadBox.style.minHeight = document.documentElement.clientHeight + 'px'
	},
	closeLoading: function () {
		//关闭loading
		var pageBody = document.getElementsByClassName('pageBody')[0]
		var loadBox = document.getElementsByClassName('loadBox')[0]
		loadBox.style.width = 0
		loadBox.style.height = 0
		loadBox.style.minHeight = 0
		// pageBody.removeChild(loadBox);
	},
	/*
		名称：load
		功能：启动加载动画
		参数：params对象 this
	*/
	load: function (params) {
		loading = params.$loading({
			lock: true,
			text: 'Loading',
			spinner: 'el-icon-loading',
			background: 'rgba(0, 0, 0, 0.15)'
		})
	},

	/*
		名称：close
		功能：关闭加载动画
		参数：无
	*/
	close: function () {
		loading.close()
	},

	/*
    转换  开始工作时间的字段
    time:传进来的参数 例子：00:00转换成24 / 10:00转换成10
  */
	getConvertTime(time) {
		let start_time = 0
		time = time.toString()
		switch (time) {
			case '00:00':
				start_time = 0
				break
			case '00:30':
				start_time = 0.5
				break
			case '01:00':
				start_time = 1
				break
			case '01:30':
				start_time = 1.5
				break
			case '02:00':
				start_time = 2
				break
			case '02:30':
				start_time = 2.5
				break
			case '03:00':
				start_time = 3
				break
			case '03:30':
				start_time = 3.5
				break
			case '04:00':
				start_time = 4
				break
			case '04:30':
				start_time = 4.5
				break
			case '05:00':
				start_time = 5
				break
			case '05:30':
				start_time = 5.5
				break
			case '06:00':
				start_time = 6
				break
			case '06:30':
				start_time = 6.5
				break
			case '07:00':
				start_time = 7
				break
			case '07:30':
				start_time = 7.5
				break
			case '08:00':
				start_time = 8
				break
			case '08:30':
				start_time = 8.5
				break
			case '09:00':
				start_time = 9
				break
			case '09:30':
				start_time = 9.5
				break
			case '10:00':
				start_time = 10
				break
			case '10:30':
				start_time = 10.5
				break
			case '11:00':
				start_time = 11
				break
			case '11:30':
				start_time = 11.5
				break
			case '12:00':
				start_time = 12
				break
			case '12:30':
				start_time = 12.5
				break
			case '13:00':
				start_time = 13
				break
			case '13:30':
				start_time = 13.5
				break
			case '14:00':
				start_time = 14
				break
			case '14:30':
				start_time = 14.5
				break
			case '15:00':
				start_time = 15
				break
			case '15:30':
				start_time = 15.5
				break
			case '16:00':
				start_time = 16
				break
			case '16:30':
				start_time = 16.5
				break
			case '17:00':
				start_time = 17
				break
			case '17:30':
				start_time = 17.5
				break
			case '18:00':
				start_time = 18
				break
			case '18:30':
				start_time = 18.5
				break
			case '19:00':
				start_time = 19
				break
			case '19:30':
				start_time = 19.5
				break
			case '20:00':
				start_time = 20
				break
			case '20:30':
				start_time = 20.5
				break
			case '21:00':
				start_time = 21
				break
			case '21:30':
				start_time = 21.5
				break
			case '22:00':
				start_time = 22
				break
			case '22:30':
				start_time = 22.5
				break
			case '23:00':
				start_time = 23
				break
			case '23:30':
				start_time = 23.5
				break
		}
		return start_time
	},
	/*
		转换  开始工作时间的字段
		time:传进来的参数 例子：24转换成00:00 / 10转换成10:10
	*/
	getReversalTime(time) {
		let start_time = '00:00'
		time = time.toString()
		// console.log(typeof(time));
		switch (time) {
			case '0':
				start_time = '00:00'
				break
			case '0.5':
				start_time = '00:30'
				break
			case '1':
				start_time = '01:00'
				break
			case '1.5':
				start_time = '01:30'
				break
			case '2':
				start_time = '02:00'
				break
			case '2.5':
				start_time = '02:30'
				break
			case '3':
				start_time = '03:00'
				break
			case '3.5':
				start_time = '03:30'
				break
			case '4':
				start_time = '04:00'
				break
			case '4.5':
				start_time = '04:30'
				break
			case '5':
				start_time = '05:00'
				break
			case '5.5':
				start_time = '05:30'
				break
			case '6':
				start_time = '06:00'
				break
			case '6.5':
				start_time = '06:30'
				break
			case '7':
				start_time = '07:00'
				break
			case '7.5':
				start_time = '07:30'
				break
			case '8':
				start_time = '08:00'
				break
			case '8.5':
				start_time = '08:30'
				break
			case '9':
				start_time = '09:00'
				break
			case '9.5':
				start_time = '09:30'
				break
			case '10':
				start_time = '10:00'
				break
			case '10.5':
				start_time = '10:30'
				break
			case '11':
				start_time = '11:00'
				break
			case '11.5':
				start_time = '11:30'
				break
			case '12':
				start_time = '12:00'
				break
			case '12.5':
				start_time = '12:30'
				break
			case '13':
				start_time = '13:00'
				break
			case '13.5':
				start_time = '13:30'
				break
			case '14':
				start_time = '14:00'
				break
			case '14.5':
				start_time = '14:30'
				break
			case '15':
				start_time = '15:00'
				break
			case '15.5':
				start_time = '15:30'
				break
			case '16':
				start_time = '16:00'
				break
			case '16.5':
				start_time = '16:30'
				break
			case '17':
				start_time = '17:00'
				break
			case '17.5':
				start_time = '17:30'
				break
			case '18':
				start_time = '18:00'
				break
			case '18.5':
				start_time = '18:30'
				break
			case '19':
				start_time = '19:00'
				break
			case '19.5':
				start_time = '19:30'
				break
			case '20':
				start_time = '20:00'
				break
			case '20.5':
				start_time = '20:30'
				break
			case '21':
				start_time = '21:00'
				break
			case '21.5':
				start_time = '21:30'
				break
			case '22':
				start_time = '22:00'
				break
			case '22.5':
				start_time = '22:30'
				break
			case '23':
				start_time = '23:00'
				break
			case '23.5':
				start_time = '23:30'
				break
		}
		return start_time
	}
}



//////////////////
// WEBPACK FOOTER
// ./static/tool.js
// module id = 0o0z
// module chunks = 1 2